<?php
$id=$_GET['id'];
$sql="select hinhdaidien from dm_sanpham where id=".$id;
$rs=mysql_query($sql);
$r=mysql_fetch_assoc($rs);
if(file_exists("../images/sanpham/hinhdaidien/".$r['hinhdaidien'])) {unlink("../images/sanpham/hinhdaidien/".$r['hinhdaidien']);}

$sql="delete from dm_sanpham where id=".$id;
mysql_query($sql);
echo'<script>window.location="?action=sanpham";</script>';
?>